<%-- 
    Document   : car
    Created on : 29.11.2012, 17:35:27
    Author     : Ondra
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="${pageContext.request.contextPath}/styly.css" type="text/css" rel="stylesheet"/>
        <title></title>
    </head>
    <body>

        <div class="wrapper">
            <div class="header"><h1><spring:message code="car.header.list"/></h1></div>
            <div class="navig">
                <%@ include file="../navig.jsp" %>
            </div>  
            <div class="content">
                
                <table>
                    <thead>
                       
                    </thead>
                    <tr>
                        <th>
                            ID 
                        </th>
                        <th>
                            SPZ
                        </th>
                        <th>
                            <spring:message code="car.type"/> 
                        </th>
                        <th>
                            <spring:message code="car.color"/> 
                        </th>
                        <th>
                            <spring:message code="car.count"/> 
                        </th>
                        <th>
                            <spring:message code="car.availability"/> 
                        </th>
                        <th>
                            <spring:message code="car.company"/> 
                        </th>
                    </tr>
                    <% int i = 1;%>
                    <c:forEach items="${list}" var="car">
                        <% if (i++ % 2 != 0) {
                             out.print("<tr class=\"highlight\">");
                                                 }
                           else {out.print("<tr>");}
                        %>

                        <td><c:out value="${car.id} " /></td>
                        <td><c:out value="${car.spz} " /></td>
                        <td><c:out value="${car.type} " /></td>
                        <td><c:out value="${car.colour} " /></td>
                        <td><c:out value="${car.numberOfSeats} " /></td>
                        <td><c:out value="${car.available} " /></td>
                        <td><c:out value="${car.company.name} " /></td>
                        <td><a href="/restfrontend/car/edit/${car.id}"><spring:message code="car.edit"/></a></td>
                        <td><a href="/restfrontend/car/delete/${car.id}" onclick="return confirm('Opravdu chtete smazatáz záznam?')"><spring:message code="car.delete"/></a></td>
                        </tr>
                    </c:forEach> 
                </table>
                <c:url value="/car/add" var="add" />
                <a href="${add}"><spring:message code="car.add"/> </a>
            </div>
        </div>
    </body>
</html>
